package com.yanqu.road.entity.activity.hanghai;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_activity_hanghai_port")
public class HangHaiPort extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "商会UID", update = true)
    private String unionUid = "";
    @FieldTypeAnnotation(desc = "港口", update = true)
    private int portId;
    @FieldTypeAnnotation(desc = "特产ID")
    private int specId;
    @FieldTypeAnnotation(desc = "紧缺ID")
    private int lackId;
    @FieldTypeAnnotation(desc = "货物列表")
    private Map<Integer, HangHaiGoods> goodsMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "上报人ID，0表示没有")
    private long reportUserId;

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public void setUnionUid(String unionUid) {
        if (null == unionUid) {
            return;
        }
        if (!this.unionUid.equals(unionUid)) {
            this.unionUid = unionUid;
            setOp(DataStatus.Update);
        }
    }

    public void setPortId(int portId) {
        if (this.portId != portId) {
            this.portId = portId;
            setOp(DataStatus.Update);
        }
    }

    public void setSpecId(int specId) {
        if (this.specId != specId) {
            this.specId = specId;
            setOp(DataStatus.Update);
        }
    }

    public void setLackId(int lackId) {
        if (this.lackId != lackId) {
            this.lackId = lackId;
            setOp(DataStatus.Update);
        }
    }

    public void setGoodsMap(Map<Integer, HangHaiGoods> goodsMap) {
        this.goodsMap = goodsMap;
        setUpdateOption();
    }

    public void setReportUserId(long reportUserId) {
        if (this.reportUserId != reportUserId) {
            this.reportUserId = reportUserId;
            setUpdateOption();
        }
    }

    public int getActivityId() {
        return activityId;
    }

    public String getUnionUid() {
        return unionUid;
    }

    public int getPortId() {
        return portId;
    }

    public int getSpecId() {
        return specId;
    }

    public int getLackId() {
        return lackId;
    }

    public Map<Integer, HangHaiGoods> getGoodsMap() {
        return goodsMap;
    }

    public long getReportUserId() {
        return reportUserId;
    }
}
